# the minimum version of CMake.
cmake_minimum_required(VERSION 3.5.0)
project(SetSurface)

set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})

add_definitions(-pthread)

include_directories(${NATIVERENDER_ROOT_PATH}
                    ${NATIVERENDER_ROOT_PATH}/capbilities/base
                    ${NATIVERENDER_ROOT_PATH}/capbilities/data_producer/bitstream_reader
                    ${NATIVERENDER_ROOT_PATH}/capbilities/data_producer/data_producer_base
                    ${NATIVERENDER_ROOT_PATH}/capbilities/data_producer/demuxer
                    ${NATIVERENDER_ROOT_PATH}/capbilities/data_producer/raw_data_reader
                    ${NATIVERENDER_ROOT_PATH}/capbilities/include
                    ${NATIVERENDER_ROOT_PATH}/common
                    ${NATIVERENDER_ROOT_PATH}/common/dfx/error
                    ${NATIVERENDER_ROOT_PATH}/common/dfx/log
                    ${NATIVERENDER_ROOT_PATH}/render/include
                    ${NATIVERENDER_ROOT_PATH}/sample/multiSurface_1
                    ${NATIVERENDER_ROOT_PATH}/sample/multiSurface_2
                    ${NATIVERENDER_ROOT_PATH}/sample/multiSurface_3
                    ${NATIVERENDER_ROOT_PATH}/sample/multiSurface_4
)

set(BASE_LIBRARY
    libace_napi.z.so libEGL.so libGLESv3.so libace_ndk.z.so libuv.so libhilog_ndk.z.so
    libnative_media_codecbase.so libnative_media_core.so libnative_media_vdec.so libnative_window.so
    libnative_media_venc.so libnative_media_avdemuxer.so libnative_media_avsource.so libnative_media_avmuxer.so
)

add_library(multiSurface_1 SHARED sample/multiSurface_1/MultiSurface_1Native.cpp
                sample/multiSurface_1/MultiSurface_1.cpp
                capbilities/base/video_sample_base.cpp
                capbilities/data_producer/bitstream_reader/bitstream_reader.cpp
                capbilities/data_producer/data_producer_base/data_producer_base.cpp
                capbilities/data_producer/demuxer/demuxer.cpp
                capbilities/data_producer/raw_data_reader/raw_data_reader.cpp
                capbilities/video_decoder.cpp
                render/egl_core.cpp
                render/plugin_render.cpp
                render/plugin_manager.cpp
                common/sample_callback.cpp
                sample/multiSurface_2/MultiSurface_2.cpp
                sample/multiSurface_3/MultiSurface_3.cpp
                sample/multiSurface_3/MultiSurface_3Manager.cpp
                sample/multiSurface_4/MultiSurface_4.cpp
                sample/multiSurface_4/MultiSurface_4Manager.cpp
)

add_library(multiSurface_2 SHARED sample/multiSurface_2/MultiSurface_2Native.cpp
                sample/multiSurface_2/MultiSurface_2.cpp
                capbilities/base/video_sample_base.cpp
                capbilities/data_producer/bitstream_reader/bitstream_reader.cpp
                capbilities/data_producer/data_producer_base/data_producer_base.cpp
                capbilities/data_producer/demuxer/demuxer.cpp
                capbilities/data_producer/raw_data_reader/raw_data_reader.cpp
                capbilities/video_decoder.cpp
                render/egl_core.cpp
                render/plugin_render.cpp
                render/plugin_manager.cpp
                common/sample_callback.cpp
                sample/multiSurface_1/MultiSurface_1.cpp
                sample/multiSurface_3/MultiSurface_3.cpp
                sample/multiSurface_3/MultiSurface_3Manager.cpp
                sample/multiSurface_4/MultiSurface_4.cpp
                sample/multiSurface_4/MultiSurface_4Manager.cpp
)

add_library(multiSurface_3 SHARED sample/multiSurface_3/MultiSurface_3Native.cpp
                sample/multiSurface_3/MultiSurface_3.cpp
                sample/multiSurface_3/MultiSurface_3Manager.cpp
                capbilities/base/video_sample_base.cpp
                capbilities/data_producer/bitstream_reader/bitstream_reader.cpp
                capbilities/data_producer/data_producer_base/data_producer_base.cpp
                capbilities/data_producer/demuxer/demuxer.cpp
                capbilities/data_producer/raw_data_reader/raw_data_reader.cpp
                capbilities/video_decoder.cpp
                render/egl_core.cpp
                render/plugin_render.cpp
                render/plugin_manager.cpp
                common/sample_callback.cpp
                sample/multiSurface_1/MultiSurface_1.cpp
                sample/multiSurface_2/MultiSurface_2.cpp
                sample/multiSurface_4/MultiSurface_4.cpp
                sample/multiSurface_4/MultiSurface_4Manager.cpp
)

add_library(multiSurface_4 SHARED sample/multiSurface_4/MultiSurface_4Native.cpp
                sample/multiSurface_4/MultiSurface_4.cpp
                sample/multiSurface_4/MultiSurface_4Manager.cpp
                capbilities/base/video_sample_base.cpp
                capbilities/data_producer/bitstream_reader/bitstream_reader.cpp
                capbilities/data_producer/data_producer_base/data_producer_base.cpp
                capbilities/data_producer/demuxer/demuxer.cpp
                capbilities/data_producer/raw_data_reader/raw_data_reader.cpp
                capbilities/video_decoder.cpp
                render/egl_core.cpp
                render/plugin_render.cpp
                render/plugin_manager.cpp
                common/sample_callback.cpp
                sample/multiSurface_1/MultiSurface_1.cpp
                sample/multiSurface_2/MultiSurface_2.cpp
                sample/multiSurface_3/MultiSurface_3.cpp
                sample/multiSurface_3/MultiSurface_3Manager.cpp
)

target_link_libraries(multiSurface_1 PUBLIC ${BASE_LIBRARY})
target_link_libraries(multiSurface_2 PUBLIC ${BASE_LIBRARY})
target_link_libraries(multiSurface_3 PUBLIC ${BASE_LIBRARY})
target_link_libraries(multiSurface_4 PUBLIC ${BASE_LIBRARY})